<template>
  <div>
    <el-descriptions class="margin-top" :column="2" border>
      <el-descriptions-item :label="dataList.ProgrammeNumber">
        {{ formData.num }}
      </el-descriptions-item>
      <el-descriptions-item :label="dataList.ProgrammeName">
        {{ formData.name }}
      </el-descriptions-item>
      <el-descriptions-item :label="dataList.PreparedName">
        {{ formData.preparedUser.name }}
      </el-descriptions-item>
      <el-descriptions-item :label="dataList.ProgrammeName">
        {{ formData.preparedDate }}
      </el-descriptions-item>
      <el-descriptions-item :label="dataList.Deviceremark">
        {{ formData.remark }}
      </el-descriptions-item>
    </el-descriptions>

    <el-table
      :data="formData.deviceVerificationInfoDtoList"
      element-loading-text="Loading"
      height="430"
      fit
      highlight-current-row
    >
      <el-table-column :label="dataList.DeviceNumber">
        <template slot-scope="scope">
          {{ scope.row.deviceDto.num }}
        </template>
      </el-table-column>
      <el-table-column
        :label="
          $i18n.locale === 'en' ? dataList.DeviceEName : dataList.DeviceName
        "
      >
        <template slot-scope="scope">
          {{ scope.row.deviceDto.name }}
        </template>
      </el-table-column>
      <el-table-column :label="dataList.DeviceSpecifications">
        <template slot-scope="scope">
          {{ scope.row.deviceDto.specifications }}
        </template>
      </el-table-column>
      <el-table-column :label="dataList.InspectionTarget">
        <template slot-scope="scope">
          {{ scope.row.verificationObject }}
        </template>
      </el-table-column>

      <el-table-column :label="dataList.InspectionMethod">
        <template slot-scope="scope">
          {{ scope.row.verificationWay }}
        </template>
      </el-table-column>
      <el-table-column :label="dataList.InspectionProcedure">
        <template slot-scope="scope">
          {{ scope.row.verificationMethod }}
        </template>
      </el-table-column>
    </el-table>
    <BasePagination
      :total="pagination.total"
      :current-page="pagination.pageIndex"
      :page-count="pagination.total"
      @changePage="changePage"
      @sizeChange="sizeChange"
    />
  </div>
</template>

<script>
import { getList } from "../../../api/DeviceVerification";
export default {
  name: "DeviceVerificationView",
  components: {},
  props: {
    id: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      verificationData: {
        verificationWayList: [],
        verificationObjectList: [],
        verificationMethod: "",
      },
      rows: [],
      idList: [],
      bomCheckKey: 0,
      settingVisible: false,
      list: [],
      tableDatas: [],
      importVisible: false,
      choiceDeviceVisible: false,
      loading: false,
      innerDialogFormVisible: false,
      formLabelWidth: "100px",
      deviceNameNum: "",

      formData: {
        id: 0,
        num: "",
        name: "",
        status: 0,
        statusName: "",
        prepared: 0,
        preparedName: "",
        preparedDate: 0,
        remark: "",
      },
      pagination: {
        pageIndex: 1,
        pageSize: 10,
        total: 0,
      },
    };
  },
  computed: {
    btn() {
      return this.$t("ModuleDevice.buttons");
    },
    dataList() {
      return this.$t("ModuleDevice.Device");
    },
  },
  watch: {},
  created() {
    this.getList();
  },
  methods: {
    getList() {
      getList({ id: this.id }, { pageIndex: 1, pageSize: 1 }).then((res) => {
        this.formData = res.data.dataList[0];
      });
    },
    changePage(val) {
      this.pagination.pageIndex = val;
      this.getList();
    },
    sizeChange(val) {
      this.pagination.pageIndex = 1;
      this.pagination.pageSize = val;
      this.getList();
    },
    // 导出
    derive() {},
  },
};
</script>
<style scoped>
table {
  border-collapse: collapse; /* 合并边框，使其一致 */
  width: 100%;
}
table,
th,
td {
  border: 1px solid gainsboro; /* 设置边框的样式 */
  padding: 8px; /* 可选：设置单元格的内边距 */
}
td {
  text-align: center; /* 水平居中对齐 */
  vertical-align: middle; /* 垂直居中对齐 */
}
#styled-table2 tr:first-child {
  background-color: ghostwhite;
}

#styled-table td:nth-child(1),
#styled-table td:nth-child(3) {
  background-color: ghostwhite;
}
</style>
